/*
 * FishFactory.cpp
 *
 *  Created on: Oct 20, 2012
 *      Author: quyetnd
 */

#include "FishFactory.h"
Fish* FishFactory::genFish(float depth){
	int type = 1+(rand()%3);
	bool flipX = rand()%2;
	float speed = 30 + (rand()%40);

	char fishName[128];
	sprintf(fishName,"fish-%d.png",type);
	CCLog("fish name = %s",fishName);
	Fish* fish = new Fish();
	fish->initWithSpriteFrameName(fishName);
	fish->autorelease();

	if(flipX){
		fish->setFlipX(true);
		fish->moveSpeed = speed;
		return fish;
	}
	else{
		fish->setFlipX(false);
		fish->moveSpeed = -speed;
		return fish;
	}

	return NULL;
}
